/*
 * Copyright 2010 Michael Nitsche
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package de.mnit.basis.swt.element.feld.baum;

import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.TreeColumn;
import org.eclipse.swt.widgets.Widget;

import de.mnit.basis.daten.konstant.position.POSITION_H;
import de.mnit.basis.fehler.Fehler;
import de.mnit.basis.swt.element.feld.A_SWT_Feld;


/**
 * @author Michael Nitsche
 */
public class SWT_BaumSpalte extends A_SWT_Feld<SWT_BaumSpalte,TreeColumn> {

	private String text;

	public SWT_BaumSpalte(String text) {
		this.text=text;
	}


	public void sBreite(int breite) {
		Fehler.zahl.wenn_Ausserhalb(10,1000,breite,1);
		swt().setWidth(breite);
	}

	public void sPosition(POSITION_H a) {
		Fehler.objekt.wenn_Null(a,1);
		if(a==POSITION_H.LINKS)  swt().setAlignment(SWT.LEFT);
		if(a==POSITION_H.MITTE)  swt().setAlignment(SWT.CENTER);
		if(a==POSITION_H.RECHTS) swt().setAlignment(SWT.RIGHT);
	}

	public void sTip(String t) {
		swt().setToolTipText(t);
	}

	// ERZEUGEN

	protected int style3() {
		return SWT.RIGHT;
	}

	protected TreeColumn roh(Widget basis, int style) {
		return new TreeColumn((Tree)basis,style);
	}

	protected void init3() {
		swt().setText(this.text);
		swt().setWidth(200);
	}

}
